#include <stdio.h>
#include "string.h"
#include <stdbool.h>

struct customer{
    int customer_id;
    char name[20];
    char customer_meal[20];
    int send_time;
    char addr[20];
    double price_all;
    bool condition;

};
void main(void){
struct customer list[20];
    int input;
    char menu_name[4][20] = {
        "黄焖鸡", 
        "鱼香肉丝",
        "麻婆豆腐",
        "清炒土豆丝"
    };
    double price[4]={25,20,10,8};
    int good[4]={0};
    do{
        printf("************\n");
        printf("1我要订餐\n");
        printf("2查看餐袋\n");
        printf("3签收订单\n");
        printf("4删除订单\n");
        printf("5我要点赞\n");
        printf("6退出系统\n");
        printf("************\n");
        printf("请输入1-6:\n");
        scanf("%d",&input);
        //点餐模块S
        if(input==1)
        {
            printf("***我要订餐***\n");
            //char name[20];
            printf("请输入订餐人姓名：");
            struct customer c1;
            scanf("%s",c1.name);
            while (getchar() != '\n');
            printf("读取姓名后：%s\n",c1.name);  
            printf("序号  菜名      单价    点赞数\n");
            printf("1   %s      %.2f     %d\n",menu_name[0],price[0],good[0]);
            printf("2   %s      %.2f     %d\n",menu_name[1],price[1],good[1]);
            printf("3   %s      %.2f     %d\n",menu_name[2],price[2],good[22]);
            printf("4   %s      %.2f     %d\n",menu_name[3],price[3],good[3]);
            int book_id,book_num;
            //char addr[20];
            printf("请输菜品编号：\n");
            scanf("%d",&book_id);
            printf("请输需要份数：\n");
            scanf("%d",&book_num);
            printf("请输送餐时间：(10-20)\n");
            scanf("%d",&c1.send_time);
            printf("请输入订餐人地址：\n");
            scanf("%s",c1.addr);
            printf("订餐成功！\n");
            if(book_id==1){
                printf("您定的餐是：%s ,份数：%d\n",menu_name[0],book_num);
            }
            if(book_id==2){
                printf("您定的餐是：%s ,份数：%d\n",menu_name[1],book_num);
            }
            if(book_id==3){
                printf("您定的餐是：%s ,份数：%d\n",menu_name[2],book_num);
            }
            if(book_id==4){
                printf("您定的餐是：%s ,份数：%d\n",menu_name[3],book_num);
            }
            printf("送餐时间:%d\n",c1.send_time);
            if(book_id==1){
                printf("餐费：%f 配送费：5 总计:%f",book_num*price[0],book_num*price[0]+5);
            }
            if(book_id==2){
                printf("餐费：%f 配送费：5 总计:%f",book_num*price[1],book_num*price[1]+5);
            }
            if(book_id==3){
                printf("餐费：%f 配送费：5 总计:%f",book_num*price[2],book_num*price[2]+5);
            }
            if(book_id==4){
                printf("餐费：%f 配送费：5 总计:%f",book_num*price[3],book_num*price[3]+5);
            }
            //printf("餐费：%d 配送费：5 总计:%d",book_num*price[0],book_num*price[0]+5);
            printf("输入0返回\n");
        }
        if (input==2)
        {
            /* code */
            printf("***查看餐袋***\n");


        }
        if (input==3)
        {
            printf("***签收模块***");
            printf("请输入想要签收订单序号：");
            int get_id;
            scanf("%d",&get_id);
            c1.condition=1;
            printf("签收成功！");
            printf("输入0返回\n");
            /* code */
        }
        if (input==4)
        {
            printf("***删除模块***");
            printf("请输入想要删除订单序号：");
            int del_id;
            scanf("%d",&del_id);
            //printf("删除成功！");
            printf("输入0返回\n");
        }
        if (input==5)
        {
            printf("***点赞模块***");
            printf("请输入想要点赞的序号：");
            int custom_good;
            scanf("%d",&custom_good);
            if (custom_good==1)
            {
                good[0]++;
            }
            if (custom_good==2)
            {
                good[1]++;
            }
            if (custom_good==3)
            {
                good[2]++;
            }
            if (custom_good==4)
            {
                good[3]++;
            }
            printf("点赞成功！");
            
            printf("序号  菜名      单价    点赞数\n");
            printf("1   %s      %.2f     %d\n",menu_name[0],price[0],good[0]);
            printf("2   %s      %.2f     %d\n",menu_name[1],price[1],good[1]);
            printf("3   %s      %.2f     %d\n",menu_name[2],price[2],good[2]);
            printf("4   %s      %.2f     %d\n",menu_name[3],price[3],good[3]);
            printf("输入0返回\n");
            /* code */
        }
        if (input==6)
        {
            printf("感谢使用！");
            break;
        }
    }while(input!=6);
}